<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-18 22:33:04
 * @LastEditTime: 2023-09-18 17:15:13
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 
 */

namespace App\Models;

class Defect extends BaseModel
    {
    //
    public $table = "basedata_defect";
    protected $guarded = [];


    public function category()
        {
        return $this->belongsTo(Dic::class, "category_id", "key")->where(function ($q)
            {
            $q->where("code", 'DefectCategory');
            });
        }
    public function details()
        {
        return $this->hasMany(DefectDetails::class, "main_id");
        }
    }